import logging

# 初始化日志记录器
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)

# 添加日志记录到文件
file_handler = logging.FileHandler("application_log.txt")
file_handler.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
file_handler.setFormatter(formatter)
logger.addHandler(file_handler)

# 示例日志记录
logger.info("日志记录器初始化完成。")